﻿Public Class excercise
    Dim imagesindex As Integer = 0
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.Hide()
        mainform.Panel1.Show()
    End Sub

    Private Sub excercise_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        changePictureBox(imagesindex)
    End Sub

    Sub changePictureBox(ByVal index As Integer)
        Dim imagesleght As Integer = ImageList1.Images.Count
        PictureBox1.Image = ImageList1.Images(index)
        If index + 1 = imagesleght Then
            Button2.Visible = False
        Else
            Button2.Visible = True
        End If
        If imagesleght - imagesleght = index Then
            Button1.Visible = False
        Else
            Button1.Visible = True
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        imagesindex += 1
        changePictureBox(imagesindex)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        imagesindex -= 1
        changePictureBox(imagesindex)
    End Sub
End Class
